<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/content.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta name="keyword" content="${webSite.title}" />
		<title>${webSite.title}</title>
		<%@ include file="/jsps/modules/useragent.jsp"%>
		<link
			href="${ctx}/jsps/theme/${webSite.webSkin.filename}/image/common.css"
			rev="stylesheet" rel="stylesheet" type="text/css" />
		<link
			href="${ctx}/jsps/theme/${webSite.webSkin.filename}/image/common_edit.css"
			rev="stylesheet" rel="stylesheet" type="text/css" />
		<!-- 话费充值 -->
		<script type="text/javascript">
		function changePhone(){
			 var value = $("#custsimno").val().replace(/\D/g , "");
		  	 var str = value.substr(0, 3) + " " + value.substr(3,4) + " " + value.substr(7,4);
		  	 $("#checkMobile").text(str);
		}
		$(document).ready(function() {
			$("#frmEdit").validate({
					rules : {
						mobile : {
							required : true,
							maxlength: 11,
							minlength: 11,
							digits:true
						}
					},
					success : function(label) {
						label.html("&nbsp;").addClass(
								"checked");
					}
				});
			
		});

		function changeAgentPayment(auth){
			$.ajax({ 
	      		url:'${ctx}/getListAction!getAmountBySalesorder.htm', 
	      		type:'post', 
	      		dataType: 'json', 
	      		data:'id='+$(auth).val(),
			    success: function(json) {
			       $("#amount").html(json.amount);
			       $("#sameamount").val(json.amount);
			       $("#retailpayment").html(json.retailpayment);
			    },
			    error: function(XMLHttpRequest, textStatus, errorThrown) {
			       alert("网络出现异常");
			    }
			  });
	    }
		</script>

		<style type="text/css">
#msg_win {
	border: 1px solid #5A6DA5;
	background: #EAEAEA;
	width: 100%;
	position: absolute;
	right: 0;
	font-size: 12px;
	font-family: Arial;
	margin: 1px 1px;
	display: none;
	overflow: hidden;
	z-index: 99;
}

#msg_win .icos {
	position: absolute;
	top: 2px; *
	top: 0px;
	right: 2px;
	z-index: 9;
}

.icos a {
	float: left;
	color: #833B02;
	margin: 1px;
	text-align: center;
	font-weight: bold;
	width: 14px;
	height: 22px;
	line-height: 22px;
	padding: 1px;
	text-decoration: none;
	font-family: webdings;
}

.icos a:hover {
	color: #fff;
}

#msg_title {
	background: url(images/nav_bg.gif) repeat-x 0 0;
	border-bottom: 1px solid #A67901;
	border-top: 1px solid #FFF;
	border-left: 1px solid #FFF;
	color: #FFF;
	height: 22px;
	line-height: 20px;
	text-indent: 5px;
}

#msg_content {
	overflow: auto;
}
</style>

	</head>
	<body>
		<div id="lian_right">

			<div class="fhao_rigt" id="fhao_rigt">
				<h3 class="yd_menu" id="yd_menu">
					<div class="yd_mon sb" id="hf">
						移动充值
					</div>
				</h3>
				<div class="zjmain" id="zjmain">
					<h3 class="fhao_son" id="subMenu">
						<div class="sb ms_on" onclick="setSubDiv('recharge.do','hf1');"
							id="hf1">
							优惠充值
						</div>
					</h3>
					<div class="sub_div" id="sub_div">
						<h3 class="sdo1 mb10">
							注意：1、请先收款后充值；&nbsp;&nbsp;2、请读一遍与客户核对被充值号码和金额；
							<s:actionmessage />
						</h3>
						<div class="hf1_div" id="hf1_div">
							<form action="epIndexNewsAction!addSalesorder.htm" method="post"
								name="frmEdit" id="frmEdit">
								<div class="pie_radius">
									<div class="chzhi">
											<p>
												客户号码：
												<input type="text" class="putMobile" id="custsimno"
													name="mobile" maxlength="11" />

											</p>
											<p>
												服务密码：
												<input type="text" class="putMobile" id="custsimno"
													name="phonePassword" maxlength="8" />
											</p>

											<p>
												优惠套餐：<select id="payment" type="text" name="saleorder.saleType" onchange="changeAgentPayment(this)" style="width:210px;">
													<c:forEach items="${authoritiesBeanList}" var="auth">
														<option value="${auth.id}">${auth.name}</option>
													</c:forEach>
												</select>
											</p>
											<p>
												会  员  价：<span id="amount">${amount}</span>
												<input type="hidden" id="sameamount"
													name="amount" value="${amount}"/>
												&nbsp;&nbsp;&nbsp;&nbsp;零  售  价：<span id="retailpayment">${retailpayment}</span>
											</p>
											<p class="btnp">
												<input type="submit" class="btn05 fweit ml76" value="点此充值"
													id="confirmBt" />
											</p>
									</div>
								</div>
							</form>
						</div>

						<h3 class="title1">
							历史记录
						</h3>
						<table cellspacing="0" cellpadding="0" class="result_tb">
							<tbody>
								<tr>
									<th style="width: 80px;">
										代理人
									</th>
									<th style="width: 110px;">
										客户号码
									</th>
									<th style="width: 110px;">
										服务密码
									</th>
									<th style="width: 170px;">
										优惠套餐
									</th>
									<th style="width: 60px;">
										代理价
									</th>
									<th style="width: 70px;">
										受理状态
									</th>
									<th style="width: 70px;">
										付款状态
									</th>
									<th style="width: 90px;">
										登记时间
									</th>
									<th style="width: 170px;">
										备注
									</th>
								</tr>

								<c:forEach items="${saleorderList}" var="saleorder">
									<tr>
										<td>
											${saleorder.user.name}
										</td>
										<td>
											${saleorder.saleNo}
										</td>
										<td>
											${saleorder.phonePassword}
										</td>
										<td>
											${saleorder.saleType}
										</td>
										<td>
											${saleorder.discount}
										</td>
										<td>
											<c:if test="${saleorder.phoneState == 0}">待办理</c:if>
											<c:if test="${saleorder.phoneState == 1}">办理中</c:if>
											<c:if test="${saleorder.phoneState == 2}"><font color="red">已成功</font></c:if>
											<c:if test="${saleorder.phoneState == 3}"><font color="blue">已失败</font></c:if>
										</td>
										<td>
											<c:if test="${saleorder.paymentState == 0}">未付款</c:if>
											<c:if test="${saleorder.paymentState == 1}">已付款</c:if>
										</td>
										<td style="widtd: 200px;">
											<fmt:formatDate value="${saleorder.editetime}"
												pattern="yyyy-MM-dd" />
										</td>
										<td>
											${saleorder.comments}
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<s:form action="epIndexNewsAction!salesorder.htm" method="get" name="form1"
			theme="simple">
			<table class="listTable2">
				<tr>
					<td width="50%">
						&nbsp;&nbsp;共有
						<s:property value="pager.rowCount" />
						条记录，每页行数：
						<s:select name="pageSize" list="pager.pageSizeIndexs"
							theme="simple" value="pager.pageSize"
							onchange="document.all.pageNo.value='1';document.all.form1.submit();" />
						当前第
						<s:select name="pageNo" list="pager.pageNoIndexs" theme="simple"
							value="pager.pageNo" onchange="document.all.form1.submit();" />
						页
					</td>
					<td width="200px">
						<a
							href="javascript:document.all.pageNo.value='<s:property value="pager.firstPageNo" />';document.all.form1.submit();">
							<img src="${ctx}/image/jwc/first.gif" width="37" height="15" />
						</a>

						<a
							href="javascript:document.all.pageNo.value='<s:property value="pager.prePageNo" />';document.all.form1.submit();">
							<img src="${ctx}/image/jwc/back.gif" width="43" height="15" />
						</a>

						<a
							href="javascript:document.all.pageNo.value='<s:property value="pager.nextPageNo"/>';document.all.form1.submit();">
							<img src="${ctx}/image/jwc/next.gif" width="43" height="15" />
						</a>

						<a
							href="javascript:document.all.pageNo.value='<s:property value="pager.lastPageNo" />';document.all.form1.submit();">
							<img src="${ctx}/image/jwc/last.gif" width="37" height="15" />
						</a>
					</td>
				</tr>
			</table>
		</s:form>
						
					</div>
				</div>
			</div>
		</div>
	</body>
</html>